package action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import action.base.BaseAction;
@Controller
@Scope("prototype")
public class LogoutAction extends BaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private boolean success = false;

	/**
	 * 用户退出
	 * 
	 * @return
	 */
	public String logout(HttpServletRequest request) throws Exception {
		super.getSession().remove("user");
		HttpSession session = request.getSession(false);
		session.setAttribute("user", null);
		super.getSession().clear();
		setSuccess(true);
		return "success";
	}

	public String logout() throws Exception {
		super.getSession().remove("user");
		super.getSession().clear();
		setSuccess(true);
		return "success";
	}

	public boolean isSuccess() {
		return success;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

}
